<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
	<title>项目立项管理</title>
	<meta name="description" content="项目立项管理">
	<meta name="content-type" content="text/html; charset=UTF-8">
	<%@include file="../resource.jsp" %>	
</head>
	<body>
				<div class="mini-toolbar"
						style="padding:0px;border-top:0;border-left:0;border-right:0;">
						<table style='width:100%;'>
							<tr>
								<td style='width:100%;white-space:nowrap;'>
									<a class="mini-button" iconCls="icon-add" plain="true" onclick="base().New('<%=path%>/promanage/addProManage.jsp');" visible="true">新增</a>
									<a class="mini-button" iconCls="icon-edit" plain="true" onclick="base().Edit();" visible="true">修改</a>
									<a class="mini-button" iconCls="icon-remove" plain="true" onclick="base().Delete();" visible="true">删除</a>
								</td>
								<td style='white-space:nowrap;' id='rightGridToolBar'>
									<span class='separator'></span> 
										<label>文件名称: </label>
										<input id="Key"	class='mini-textbox' emptyText="文件名" onenter="LoadUserInfo" />
										<a class='mini-button' iconCls='icon-search' plain='true' onclick="LoadUserInfo">查询</a> <span class='separator'>
									</span>
									<a class='mini-button' id="btnRefresh" iconCls='icon-reload' plain='true' onclick='LoadUserInfo()'>刷新</a>
								</td>
							</tr>
						</table>
					</div>
		<!--撑满页面-->
		<div class='mini-fit' style='width:100%;height:100%;'>
			<div id='miniDataGrid' class='mini-datagrid' style='width:100%;height:100%;' allowAlternating="true" idField='unid' sizeList='[15,30,50,100]' pageSize='15' multiSelect='true' showColumnsMenu='true'>
			<div property='columns'>
				<div type='indexcolumn'></div>
				<div type='checkcolumn'></div>
                <div field='projectNo' 	width='200' allowSort='true' headerAlign='left'  align='left'>项目编号</div>
                <div field='projectName' width='200' allowSort='true' headerAlign='left'  align='left'>项目名称</div>
				<div field='projectType' width='150' allowSort='true' headerAlign='left'  align='left'>项目类型</div>
                <div field='expectStartDate' width='150' allowSort='true' headerAlign='left'  align='left' dateFormat='yyyy-MM-dd hh:mm:ss'>启动时间</div>
				<div field='createBy' 	width='150' allowSort='true' headerAlign='left'  align='left'>制单人</div>
                <div field='createDate' width='150' allowSort='true' headerAlign='left'  align='left' dateFormat='yyyy-MM-dd hh:mm:ss'>制单时间</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	mini.parse();
	var grid = mini.get('miniDataGrid');
	grid.setUrl('<%=path%>/promanage/findAllPromanageJson.action');
	grid.load();
	
	var base = function(){//增删改查操作
		return {
			New:function(org){
				mini.open({
				    url: org,
				    title: "新增项目立项", width: 600, height: 400,
				    onload: function () {
				        var iframe = this.getIFrameEl();
				        var data = { action: "new"};
				        iframe.contentWindow.SetData(data);
				    },
				    ondestroy: function (action) {
				        grid.reload();
				    }
				});
			},
			Edit:function(){
				var docId=this.GetSelectedDocId();
				if(docId==''){ return }
				if(docId.split('^').length>1){ mini.alert('请选择一条文档！');return }
				var docs=grid.getSelecteds();
				var openMain='editDocument'
				if(docs[0].WFStatus==2 || gCurUser.indexOf(docs[0].CurUser)==-1){ 
					openMain='openDocument'
				}
				var path='/'+gTargetDBPath+'/'+gViewName+'/'+docId+'?'+openMain;
				window.open(path,'_blank','status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,left=0,top=0,width='+(screen.availWidth - 10) +',height=' + (screen.availHeight - 30));

				/*var row = grid.getSelected();
	            if (row) {
	                mini.open({
	                    url: bootPATH + "../demo/CommonLibs/EmployeeWindow.html",
	                    title: "编辑员工", width: 600, height: 400,
	                    onload: function () {
	                        var iframe = this.getIFrameEl();
	                        var data = { action: "edit", id: row.id };
	                        iframe.contentWindow.SetData(data);
	                    },
	                    ondestroy: function (action) {
	                        grid.reload();
	                    }
	                });
	            } else {
	                alert("请选中一条记录");
	            }*/
					
				},
			Delete:function(){
				var docId=this.GetSelectedDocId();
				if(docId==''){ return }
				mini.confirm('继续操作将删除该项目框图下所有数据！确认继续吗？','操作提示', function(action){
				if(action=="ok"){
				grid.loading('数据删除中！');
				var path='/'+gTargetDBPath+'/agtDelDoc?OpenAgent';
				$.post(path,{
					dbPath:gTargetDBPath,
					docId:docId
				},function(data){
					RefreshGridData();
					this.infoMsgShow("删除成功！");
					})
				   }
				})
			},
		   GetSelectedDocId:function(){
				var docs=grid.getSelecteds();
				if(docs.length==0){
					mini.alert('请选择一条文档!');
					return '';
				}
				var strIds='';
				$.each(docs,function(){
					if(strIds!=''){ strIds+='^' }
					strIds+=this.unid
				})
					return strIds;
				},
				infoMsgShow:function(){//消息提示
					/*$("#infoMsg").html(org);
					$("#infoShow").show(400);
					setTimeout(this.infoMsgHide,2000);*/
				},
				infoMsgHide:function(){//消息消失
				/*	$("#infoShow").hide(400);*/
				}
			}
		};
	
	
	</script>
	
	
</body>
</html>
